<?php
// 本文档自动生成，仅供测试运行
class IndexAction extends Action
{
    /**
    +----------------------------------------------------------
    * 默认操作
    +----------------------------------------------------------
    */
    public function index() {
        //$this->display('/Login/loginPage.html');
        //$this->display();
        $this->display();
    }
    /**
    +----------------------------------------------------------
    * 探针模式
    +----------------------------------------------------------
    */
    public function checkEnv() {
        load('pointer',THINK_PATH.'/Tpl/Autoindex');//载入探针函数
        $env_table = check_env();//根据当前函数获取当前环境
        echo $env_table;
    }
	
	public function studentMain()
	{
		
		if(isset($_SESSION['id'])){			
			$id = $_SESSION['id'];
			$name = $_SESSION['name'];
			$stuhomework = M('stuhomework');
			$student_dao = M('student');
			$condition['stu_id'] = $id;
			$result = $stuhomework->where($condition)->select();
			$condition_id['id'] = $id;
			$student = $student_dao->where($condition_id)->find();
			$homeworkinfo = M('homeworkinfo');
			foreach ($result as  $key => $value) {
				$condition2['id'] = $value['hw_id'];
				$result2 = $homeworkinfo->where($condition2)->find();
				$result[$key]['deadline'] = $result2['deadline'];
				$result[$key]['head'] = $result2['head'];
			}		
			$this->assign('homework', $result);
			$this->assign('student', $student);
			$this->display();
	    }
		else{
			
		}
	}
   
    public function adminMain()
	{
		if(isset($_SESSION['id'])){
			$id = $_SESSION['id'];
			$name = $_SESSION['name'];
			$homeworkinfo = M('homeworkinfo');
			$result = $homeworkinfo->select();
			$this->assign('homework', $result);
			$this->display();
		}
		else{
			
		}
	}





}
?>